package com.tools.cleanmaster.model.db;

import java.util.HashSet;


public class TrashDBBeanFilter implements DBBeanFilter<ResidualTrashBean> {
    private HashSet<String> pkgNames;
    public TrashDBBeanFilter(Iterable<String> pkgNames) {
        HashSet<String> hSet = new HashSet<String>();
        for(String pkg : pkgNames){
            hSet.add(pkg);
        }
        this.pkgNames = hSet;
    }

    @Override
    public boolean needFilter(ResidualTrashBean bean) {
        String[] pkgs = bean.getPkgs();
        for(String pkg : pkgs){
            if(pkgNames.contains(pkg)){
                return true;
            }
        }
        return false;
    }
}
